package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.SalaryBillAddDTO;
import org.jsola.hr.dto.SalaryBillUpdateDTO;
import org.jsola.hr.dto.excel.SalaryBillImportDTO;
import org.jsola.hr.query.SalaryBillQuery;
import org.jsola.hr.vo.SalaryBillImportExcelVO;
import org.jsola.hr.vo.SalaryBillListRelationVO;
import org.jsola.hr.vo.SalaryBillListVO;
import org.jsola.hr.vo.SalaryBillVO;
import org.jsola.hr.vo.excel.ParseResultVO;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 工资条
 *
 * @author zhr
 */
@Api(tags = "hr-工资条")
public interface ISalaryBillControllerAPI {

    /**
     * 新增工资条
     * @param salaryBillAddDTO 工资条新增实体
     * @return 工资条展示对象
     */
    @ApiOperation(value = "新增工资条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillAddDTO", dataType = "SalaryBillAddDTO", value = "新增工资条", paramType = "body")
    })
    Result<SalaryBillVO> save(SalaryBillAddDTO salaryBillAddDTO);


    /**
     * 修改工资条
     * @param salaryBillUpdateDTO 工资条
     * @return 更新数量
     */
    @ApiOperation(value = "修改工资条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillUpdateDTO", dataType = "SalaryBillUpdateDTO", value = "修改工资条", paramType = "body")
    })
    Result<Integer> update(SalaryBillUpdateDTO salaryBillUpdateDTO);




    /**
     * 删除单个工资条，彻底删除
     * @param salaryBillId 工资条id
     * @return 删除数量
     */
    @ApiOperation(value="删除单个工资条，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillId", dataType = "String", value = "工资条id", paramType = "path")
    })
    Result<Integer> delete(String salaryBillId);


    /**
     * 批量删除工资条，彻底删除
     * @param salaryBillIds 工资条id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除工资条，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillIds", dataType = "String[]", value = "工资条id数组", paramType = "body" ,allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] salaryBillIds);


    /**
     * 根据工资条id查询工资条详情
     * @param salaryBillId 工资条id
     * @return 工资条详情
     */
    @ApiOperation(value="根据工资条id查询工资条详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillId", dataType = "String", value = "工资条id", paramType = "path")
    })
    Result<SalaryBillVO> findById(String salaryBillId);


    /**
     * 查询工资条
     * @param salaryBillQuery 工资条查询参数
     * @return page
     */
    @ApiOperation(value="查询工资条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillQuery", dataType = "SalaryBillQuery", value = "工资条查询参数", paramType = "query")
    })
    Result<List<SalaryBillListVO>> listAll(SalaryBillQuery salaryBillQuery);


     /**
     * 分页查询工资条
     * @param salaryBillQuery 工资条查询参数
     * @return page
     */
    @ApiOperation(value="分页查询工资条")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillQuery", dataType = "SalaryBillQuery", value = "工资条查询参数", paramType = "query")
    })
    Result<Page<SalaryBillListVO>> page(SalaryBillQuery salaryBillQuery);

    /**
     * 解析excel
     * @param file 上传的文件
     * @param success true返回成功的，false返回失败的，不传返回全部
     * @return 解析结果
     */
    @ApiOperation(value = "解析excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", value = "文件，Content-Type需要设置为multipart/form-data", paramType = "form"),
            @ApiImplicitParam(name = "success", dataType = "Boolean", value = "true返回成功的，false返回失败的，不传返回全部", paramType = "query")
    })
    Result<List<ParseResultVO<SalaryBillImportDTO>>> parseImportFile(MultipartFile file, Boolean success);

     /**
     * 导入excel
     * @param file 上传的文件
     * @param force true忽略错误的行，false有错误中断上传
     * @return 导入成功数量
     */
    @ApiOperation(value = "导入excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",
                    value = "文件，Content-Type需要设置为multipart/form-data",
                    paramType = "form"),
            @ApiImplicitParam(name = "force", dataType = "Boolean", value = "true忽略错误的行，false有错误中断", paramType = "query"),
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司ID", paramType = "query"),
            @ApiImplicitParam(name = "year", dataType = "String", value = "年份", paramType = "query"),
            @ApiImplicitParam(name = "month", dataType = "String", value = "月份", paramType = "query"),
            @ApiImplicitParam(name = "tableName", dataType = "String", value = "工资表名称", paramType = "query")
    })
    Result<SalaryBillImportExcelVO> importFile(MultipartFile file, Boolean force, String companyId, String year, String month, String tableName);

    /**
     * 分页查询工资条及相关统计
     * @param salaryBillQuery 工资条查询参数
     * @return page
     */
    @ApiOperation(value="分页查询工资条及相关统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillQuery", dataType = "SalaryBillQuery", value = "工资条查询参数", paramType = "query")
    })
    Result<SalaryBillListRelationVO> pageRelation(SalaryBillQuery salaryBillQuery);

    /**
     * 查询工资条及相关统计
     * @param salaryBillQuery 工资条查询参数
     * @return SalaryBillListRelationVO
     */
    @ApiOperation(value="查询工资条及相关统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillQuery", dataType = "SalaryBillQuery", value = "工资条查询参数", paramType = "query")
    })
    Result<SalaryBillListRelationVO> listAllRelation(SalaryBillQuery salaryBillQuery);

    /**
     * 查询工资条相关信息
     * @param salaryBillUpdateDTO 工资条查询参数
     * @return SalaryBillListRelationVO
     */
    @ApiOperation(value="查询工资条相关信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "salaryBillUpdateDTO", dataType = "SalaryBillUpdateDTO", value = "工资条查询参数", paramType = "query")
    })
    Result<SalaryBillVO> getSalaryBillRelation(SalaryBillUpdateDTO salaryBillUpdateDTO);

}

